-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start filling out SQLite support #1410
Conversation
…table like` This reverts commit 7b39c31.
@@ -76,6 +76,7 @@ alter_table_stmt: | |||
| COLUMN_? old_column_name = column_name TO_ new_column_name = column_name | |||
) | |||
| ADD_ COLUMN_? column_def | |||
| DROP_ COLUMN_? column_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this support to the parser required a re-gen, which explains a lot of the size of this PR.
I would welcome any feedback on Go style etc. I've tried to follow the patterns I see in the existing code, but I'm new to Go and am probably missing some conventions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit torn about improving SQLite support using the ANTLR parser. I think the best long-term approach is to use golemon and hand-port the SQLite parser.
That said, no one is working on that and this parser currently works, so I'm happy to have you continue to work on it.
const countStarUpper = `-- name: CountStarUpper :one | ||
r; | ||
|
||
SELECT COUNT(*) FROM bar | ||
` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what's happening here, but this query is invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's something to do with the --
comment parsing. I'll look into it properly tomorrow!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue is fixed now and the code generates properly.
Thank you for all your work on this project, I'm really enjoying tinkering with it.
Interesting! I'm not against changing tack on this. I don't have a particular attachment to ANTLR, I continued with it mainly because the pieces were already in place. Just to weigh up the pros and cons, ANTLR is a very mature project and the generated parser seems to work fine for everything I've needed so far, so I'm inclined to continue with it. I understand that lemon is what SQLite itself uses so maybe there'll be some nuances that match up better by using Anyway, worst case, this work I'm doing so far will build up a good library of SQLite test cases and a list of supported sql functions which will be useful with any parser. |
Nope, the sole reason is that it would be closer to the real SQLite parser. Our PostgreSQL support is better than our MySQL support because our PostgreSQL parser is the PostgreSQL parser, where the MySQL parser is what PingCAP currently supports. That said, if you think the current parser works, I'm all for it. |
This reverts commit eaf7c4f.
This adds a few tests for SQLite and implements the necessary features to have them pass.